package edu.sjsu.cs.files;

import java.util.Scanner;

public class FileCounter
{
   public FileCounter()
   {
      characters = words = lines = 0;
   }

   public void read(Scanner afileIn)
   {
      while(afileIn.hasNextLine())
      {
         String line = afileIn.nextLine();
         lines++;
         characters+=line.length();
         
         words+= line.split(" ").length;
      }
   }

   public int getCharacterCount()
   {
      return characters;
   }

   public int getWordCount()
   {
      // TODO Auto-generated method stub
      return words;
   }
   public int getLineCount()
   {
      // TODO Auto-generated method stub
      return lines;
   }
   
   private int characters;
   private int words;
   private int lines;
   
}
